home *** CD-ROM | disk | FTP | other *** search
- property piTicks, piTickdelay, psEvaluation, psHeader, psFooter, plLetters, pzWhich, piCurQuestion, piQuestionsPerStepFrame, plpTestQuestions, plQuestionsAnswerOrder, plFirstAnswer, plRightWrong, psOld, poOwner
-
- on new me, xoOwner, xiTicks, xiQuestionBlock
- poOwner = xoOwner
- piTickdelay = xiTicks
- piQuestionsPerStepFrame = xiQuestionBlock
- plLetters = ["a", "b", "c", "d", "e"]
- return me
- end
-
- on mSetHeaderFooter me, xlChapters, xsType, xiBlockSize
- if not voidp(xiBlockSize) then
- piQuestionsPerStepFrame = xiBlockSize
- end if
- viNumChapters = count(xlChapters)
- vsChapter = "<center>Chapter "
- if viNumChapters > 1 then
- vsChapter = "<center>Chapters: "
- end if
- vsChapterNum = getAt(xlChapters, 1)
- repeat with i = 2 to viNumChapters
- vsChapterNum = vsChapterNum & ", " & getAt(xlChapters, i)
- end repeat
- xsType = makeFirstLetterUpperCase(xsType)
- psHeader = xsType & "#RETURN" & vsChapter & vsChapterNum & " " & xsType & "</center><BR><BR><BR><OL>"
- psFooter = "</OL>"
- end
-
- on stepFrame me
- if the ticks > (piTicks + piTickdelay) then
- piTicks = the ticks
- if piCurQuestion <= count(plpTestQuestions) then
- mSendData(me, piCurQuestion)
- piCurQuestion = piCurQuestion + piQuestionsPerStepFrame
- else
- vsToPrint = psHeader & psEvaluation & psFooter
- gotoNetPage("javascript:doPrintable(" & QUOTE & vsToPrint & QUOTE & ")")
- deleteOne(the actorList, me)
- the itemDelimiter = psOld
- mNotify(poOwner, #printDone, 1)
- end if
- end if
- end
-
- on mSendData me
- repeat with i = piCurQuestion to piCurQuestion + piQuestionsPerStepFrame - 1
- viCurChapter = getPropAt(plpTestQuestions, i)
- viCurChapterQuestion = getAt(plpTestQuestions, i)
- vsChapterQuestions = the text of field IntegerToString(viCurChapter, 2)
- vsAQuestion = line viCurChapterQuestion of vsChapterQuestions
- vlAnswerOrder = getAt(plQuestionsAnswerOrder, i)
- vsResult = getAt(plRightWrong, i)
- vsEvaluation = vsEvaluation & "<LI>" & item 1 of vsAQuestion & "<BR><BR>"
- delete item 1 of vsAQuestion
- vsAnswer = item 1 of vsAQuestion
- delete item 1 of vsAQuestion
- if vsAnswer <> EMPTY then
- vlAnswerOrder = GetListFrom1toX(the number of items in vsAQuestion)
- viRight = value(vsAnswer)
- else
- viRight = 1
- end if
- case pzWhich of
- #clean:
- vsEvaluation = vsEvaluation & "<OL TYPE=" & "a" & ">"
- repeat with j = 1 to the number of items in vsAQuestion
- viWhichAnswer = getAt(vlAnswerOrder, j)
- vsEvaluation = vsEvaluation & "<LI>" & item viWhichAnswer of vsAQuestion
- end repeat
- #result:
- vsEvaluation = vsEvaluation & "<OL>"
- viAnswer = getAt(plFirstAnswer, i)
- viLetterPos = getPos(vlAnswerOrder, viAnswer)
- if viLetterPos then
- vsEvaluation = vsEvaluation & "Your Answer: " & getAt(plLetters, viLetterPos) & ") " & item viAnswer of vsAQuestion & "<BR><BR>"
- end if
- if vsResult <> "right" then
- vsEvaluation = vsEvaluation & "Correct Answer: " & getAt(plLetters, getPos(vlAnswerOrder, viRight)) & ") " & item viRight of vsAQuestion
- end if
- end case
- vsEvaluation = vsEvaluation & "</OL><BR><BR>"
- end repeat
- vsEvaluation = SearchAndReplaceAll(vsEvaluation, QUOTE, """)
- vsEvaluation = SearchAndReplaceAll(vsEvaluation, "'", "")
- psEvaluation = vsEvaluation
- end
-
- on mPrintEvaluation me, xzWhich, xlpTestQuestions, xlQuestionsAnswerOrder, xlFirstAnswer, xlRightWrong
- pzWhich = xzWhich
- plpTestQuestions = xlpTestQuestions
- plQuestionsAnswerOrder = xlQuestionsAnswerOrder
- plFirstAnswer = xlFirstAnswer
- plRightWrong = xlRightWrong
- alert("The new window will take a moment to open.")
- add(the actorList, me)
- psOld = the itemDelimiter
- the itemDelimiter = TAB
- piCurQuestion = 1
- piTicks = the ticks
- end
-